package com.tadpole.music.adapter.me;

import android.app.Activity;
import android.view.LayoutInflater;

import android.view.ViewGroup;

import androidx.annotation.NonNull;
import androidx.fragment.app.FragmentManager;

import com.tadpole.music.R;
import com.tadpole.music.adapter.base.BaseAdapter;
import com.tadpole.music.bean.me.MoNiErrorBean;
import com.tadpole.music.holder.base.BaseViewHolder;

import com.tadpole.music.holder.me.AnswerStatisticsV2ViewHolder;


import java.util.List;


/**
 * Created By 孙岩
 * on 2020/12/26
 */
public class AnswerStatisticsV2Adapter extends BaseAdapter {
    private AnswerStatisticsV2ViewHolder answerStatisticsV2ViewHolder;
    private Activity activity;
    private OnChildClickListener onChildClickListener;
    private  FragmentManager fragmentManager;
    //学生id
    private int student_id;
    private String student_avatar;
    private String student_nickname;
    private List<MoNiErrorBean.DataBean> list;

    public AnswerStatisticsV2Adapter(Activity activity, FragmentManager fragmentManager,int student_id,String student_avatar,String student_nickname,List<MoNiErrorBean.DataBean> list) {
        this.activity = activity;
        this.fragmentManager =fragmentManager;
        this.student_id = student_id;
        this.student_avatar = student_avatar;
        this.student_nickname = student_nickname;
        this.list = list;
    }


    @Override
    public BaseViewHolder createRelHolder(ViewGroup parent, int viewType) {
        answerStatisticsV2ViewHolder = new AnswerStatisticsV2ViewHolder(
                activity,
                LayoutInflater.from(activity).inflate(R.layout.item_big, parent, false),
                onChildClickListener,
                fragmentManager,
                student_id,
                student_avatar,
                student_nickname,list);
        return answerStatisticsV2ViewHolder;
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public int getRelItemCount() {
        return list.size();
    }

    @Override
    public void setOnItemClickListener(OnItemClickListener listener) {

    }

    @Override
    public void setOnChildClickListener(OnChildClickListener listener) {
        this.onChildClickListener = listener;
    }

    @Override
    public void setOnLongClickListener(OnLongClickListener listener) {

    }

    @Override
    public void onBindViewHolder(@NonNull BaseViewHolder holder, int position) {
        holder.init(position-mHeadViews.size());
    }
}
